using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Windows.Forms.DataVisualization.Charting;

namespace Sec_scan漏洞扫描系统
{
    public partial class Sec_Scan_HomePage : Form
    {
        public Sec_Scan_HomePage()
        {
            InitializeComponent();
            Control.CheckForIllegalCrossThreadCalls = false;
        }

        private List<int> XList = new List<int>();
        private List<int> YList = new List<int>();
        private Random randoms = new Random();
        private void HomePage_Load(object sender, EventArgs e)
        {
            //// 假设这是六个字符串
            //string s1 = "Apple";
            //string s2 = "Banana";
            //string s3 = "Cherry";
            //string s4 = "Durian";
            //string s5 = "Eggplant";
            //string s6 = "Fig";

            //// 创建一个新的 ChartArea，或者使用默认的 ChartArea
            //ChartArea chartArea1 = new ChartArea("chartArea1");
            //chart1.ChartAreas.Add(chartArea1);

            //// 设置 X 轴和 Y 轴的属性
            //chartArea1.AxisX.Title = "Strings";
            //chartArea1.AxisY.Title = "Length";

            //// 创建一个新的 Series，用于显示字符串长度
            //Series series1 = new Series("Series1");
            //series1.ChartArea = "chartArea1";
            //series1.ChartType = SeriesChartType.Column;
            //series1.Color = Color.Blue;
            //series1.BorderWidth = 2;

            //// 将六个字符串添加到 Series 中
            //series1.Points.AddXY("s1", s1.Length);
            //series1.Points.AddXY("s2", s2.Length);
            //series1.Points.AddXY("s3", s3.Length);
            //series1.Points.AddXY("s4", s4.Length);
            //series1.Points.AddXY("s5", s5.Length);
            //series1.Points.AddXY("s6", s6.Length);

            //// 将 Series 添加到 Chart 的 Series 集合中
            //chart1.Series.Add(series1);
            //进行数据统计 漏洞统计
            Sec_System.Sec_HomeData_Statistics.PocStatistics(Sec_Api.Sec_HomeData_Statistics_Api.D1);
            string loop = Sec_Api.Sec_HomeData_Statistics_Api.LoopTotal.ToString();
            label3.Text = loop;
            //关键词统计
            Sec_System.Sec_HomeData_Statistics.WordStatistics(Sec_Api.Sec_HomeData_Statistics_Api.D1);
            string word = Sec_Api.Sec_HomeData_Statistics_Api.WordsTotal.ToString();
            label13.Text = word;
            //密码总数统计
            Sec_System.Sec_HomeData_Statistics.PassStatistics(Sec_Api.Sec_HomeData_Statistics_Api.D1);
            string pass = Sec_Api.Sec_HomeData_Statistics_Api.PassTotal.ToString();
            label11.Text = pass;
            //项目统计
            Sec_System.Sec_HomeData_Statistics.ProjectStatistics(Sec_Api.Sec_HomeData_Statistics_Api.D1);
            string pro = Sec_Api.Sec_HomeData_Statistics_Api.ProjectTotal.ToString();
            label10.Text = pro;
            ////统计图测试
            //chart2.ChartAreas[0].AxisX.MajorGrid.LineDashStyle = ChartDashStyle.NotSet; //设置网格类型为虚线
            //chart2.ChartAreas[0].AxisY.MajorGrid.LineDashStyle = ChartDashStyle.Dash; //设置网格类型为虚线
            //chart2.Series[0].IsValueShownAsLabel = true;//设置显示示数

            //for (int i = 0; i < 6; i++)
            //{
            //    XList.Add(i);
            //    YList.Add(randoms.Next(10, 100));
            //}
            ////写法同上面到 chart1.ChartAreas[0] 类似
            //chart2.Series["严重漏洞"].Points.DataBindXY(XList, YList);
            //chart2.Series["高危漏洞"].Points.DataBindXY(XList, YList);
            //chart2.Series["中危漏洞"].Points.DataBindXY(XList, YList);
            //chart2.Series["低危漏洞"].Points.DataBindXY(XList, YList);
            //chart1.Series["执行频率"].Points.DataBindXY(XList, YList);
        }
    }
}
